<template>
  <div class="app-container">
    <!-- 商户的首页 -->
    <div class="index_page flex" v-if="shopInfo">
      <div class="leftbox">
        <div class="top_box flex">
          <div class="top_card goods">
            <div class="tit flex">
              <i class="icon"></i>
              <span>商品</span>
            </div>
            <div class="top_inner" @click="goLink('/tenantGoods/goodsManage',{type:'myAccount'},'goodsManage')">
              <div class="top_item">
                <div class="val" v-if="checkPermi(['shd:home:shangpin'])">{{ goodsNum }}</div>
                <div class="val" v-else>***</div>
                <div class="label">
                  在售商品
                </div>
              </div>

            </div>
          </div>
          <div class="top_card">
            <div class="tit">
              <i class="icon"></i>
              <span>销售台</span>
            </div>
            <div class="top_inner flex">
              <div class="top_item" @click="goLink('/tenantOrders/SaleOrderPage',{orderStatus:4},'orderForTenant:orderList',true)">
                <div class="val" v-if="checkPermi(['shd:home:xiaoshoutongji'])">{{ sellData.jiaoyizhong }}</div>
                <div class="val" v-else>***</div>
                <div class="label">
                  交易中
                </div>
              </div>
              <div class="top_item" @click="goLink('/tenantOrders/SaleAfterOrder','','afterOrderForTenant:afterOrderList',true)">

                <div class="val" v-if="checkPermi(['shd:home:xiaoshoutongji'])">{{ sellData.shouhou }}</div>
                <div class="val" v-else>***</div>
                <div class="label">
                  售后中
                </div>
              </div>
              <div class="top_item" @click="goLink('/tenantOrders/SaleOrderPage',{orderStatus:1},'orderForTenant:orderList',true)">

                <div class="val" v-if="checkPermi(['shd:home:xiaoshoutongji'])">{{ sellData.wancheng }}</div>
                <div class="val" v-else>***</div>
                <div class="label">
                  交易完成
                </div>
              </div>

            </div>
          </div>
          <div class="top_card">
            <div class="tit">
              <i class="icon"></i>
              <span>回收台</span>
            </div>
            <div class="top_inner flex">
              <div class="top_item" @click="goLink('/recycleManage/recycleOrdersmyBuy',{orderStatus:1},'backOrder:orderList',true)">
                <!-- shd:home:huishoutongji -->
                <div class="val" v-if="checkPermi(['shd:home:huishoutongji'])">{{ buyData.jiaoyizhong }}</div>
                <div class="val" v-else>***</div>
                <div class="label">
                  交易中
                </div>
              </div>
              <div class="top_item" @click="goLink('/recycleManage/backorderAfterList',{orderStatus:1},'backOrder:after',true)">
                <!-- <div class="val">{{ buyData.shouhou }}</div> -->
                <div class="val" v-if="checkPermi(['shd:home:huishoutongji'])">{{ buyData.shouhou }}</div>
                <div class="val" v-else>***</div>
                <div class="label">
                  售后中
                </div>
              </div>
              <div class="top_item" @click="goLink('/recycleManage/recycleOrdersmyBuy',{orderStatus:4},'backOrder:orderList',true)">
                <!-- <div class="val">{{ buyData.wancheng }}</div> -->
                <div class="val" v-if="checkPermi(['shd:home:huishoutongji'])">{{ buyData.wancheng }}</div>
                <div class="val" v-else>***</div>
                <div class="label">
                  交易完成
                </div>
              </div>

            </div>
          </div>

        </div>
        <div class="card">
          <subtit title="数据创建"></subtit>
          <div class="dianpu_inner create_btn_box flex">
            <div class="item" @click="createOrder(item)"  v-for="(item,key) in createQuick" :key="key">
              <img width="100%" :src="item.bg" alt="">
            </div>
          </div>
        </div>
        <div class="card">
          <subtit title="数据中心"></subtit>
          <div class="add-btn flex alc" @click="openAddZhibiao">
            <img style="width: 20px;height: 20px;margin-right: 5px;" src="../assets/img/home2/addicon.png" alt="">
            <span style="color:#6C5DD3">指标</span>
          </div>
          <div class="dianpu_inner flex" v-if="shopData">
            <div class="item" v-for="(item,key) in shopData" :key="key">
              <div class="name">{{ item.label }}</div>
              <div class="value1" v-if="item.label1"><span v-if="item.showLabel1" style="font-size: 16px; color: #666;">{{ item.label1 }}</span> {{ item.value1 }}</div>
              <div class="value2">
                <span v-if="item.label2">{{ item.label2 }} {{ item.value2 }}</span>
                <span style="margin-left: 20px;" v-if="item.label3">{{ item.label3 }} {{ item.value3||0 }}</span>
              </div>
            </div>
          </div>
        </div>
        <div class="card">
          <subtit title="商家互联"></subtit>
          <div class="sjtj_inner flex" v-if="tongjiData">
            <div class="item" v-for="(item,key) in tongjiData" :key="key" @click="goLink(item.link,'',item.permiStr)">
              <div class="name flex">
                <img :src="item.icon" alt="">
                <span>{{ item.label }}</span>

              </div>
              <div class="value1"> {{ item.value1 }}</div>
            </div>
          </div>
        </div>
        <div class="card">
          <subtit title="我的应用"></subtit>
          <!-- {{ myApps }} -->
          <div class="add-btn flex alc" @click="openAddApps">
            <img style="width: 20px;height: 20px;margin-right: 5px;" src="../assets/img/home2/moreicon.png" alt="">
            <span style="color:#6C5DD3">更多</span>
          </div>
          <div class="myApp flex">
            <template v-for="(item,i) in quickApps">
              <div class="app_item" :key="i" @click="goRoute(item)">
                <img :src="item.meta.iconImg||shalou" alt="">
                <div class="name">{{ item.meta.title }}</div>
              </div>
            </template>

          </div>
        </div>

      </div>
      <div class="rgbox">
        <div class="shop_info  card">
          <div class="btns">
            <el-button type="text" @click="editShopInfoFn" v-hasPermi="['shopCenter:editInfo']"> 修改资料</el-button>
            <el-button type="text" @click="myHaibao"> 推广海报</el-button>
          </div>
          <div class="flex">
            <div class="head-img">
              <img :src="shopInfo.avatar" alt="" />
            </div>
            <div class="shop_rg">
              <div class="shop_tit_box flex">
                <b>{{ shopInfo.tenantName }}</b>
                <div class="flex">
                  <!-- 实名认证标 -->
                  <img @click="openAuth" src="../assets/img/home2/yirenzheng.png" v-if="shopInfo.authType==2||shopInfo.authType==3||shopInfo.authType==6" alt="">
                  <img @click="openAuth" v-else src="../assets/img/home2/qurenzheng.png" alt="">
                  <!-- 优质商家图标 -->
                  <!-- <img src="../assets/img/home2/youzhishangjia.png" @click="goLink('/huoyuan/youzhishangjia')" v-if="shopInfo.isQuality==2" alt="">
                  <img v-else src="../assets/img/home2/jiaruyouzhi.png" alt="" @click="goLink('/huoyuan/youzhishangjia')"> -->
                  <!-- APP商城标 -->
                  <img @click="goLink('http://'+(shopInfo.domain&&shopInfo.domain.includes(',')?shopInfo.domain.split(',')[0]:shopInfo.domain))" src="../assets/img/home2/appshangcheng.png" alt="" v-if="shopInfo&&shopInfo.groups&&shopInfo.groups.includes('5483')">
                  <img @click="goLink('/jifenshangcheng')" v-else src="../assets/img/home2/appsahngchengclose.png" alt="">
                </div>
              </div>
              <div class="name_box flex">
                <span class="flex name">
                  <img src="../assets/img/home2/tou.png" alt="">
                  <span class="val">
                    {{ userInfo.nickName }}
                  </span>
                </span>
                <span class="flex">
                  <img src="../assets/img/home2/guanwang.png" alt="">
                  <span class="val">
                    官网:
                    <el-link @click="copyStr(shopInfo.domain&&shopInfo.domain.includes(',')?shopInfo.domain.split(',')[0]:shopInfo.domain)">{{shopInfo.domain&&shopInfo.domain.includes(',')?shopInfo.domain.split(',')[0]:shopInfo.domain}}</el-link>
                  </span>
                </span>
              </div>
              <div class="phonenum">
                <span>
                  手机号:
                </span>
                <span style="color: #333;">
                  {{ userInfo.phonenumber }}
                </span>
              </div>
            </div>
          </div>
        </div>
        <div class="zhanghu_box card">
          <div class="tit-box flex">
            <span style="width: 1px;height: 16px;border: 2px solid #6C5DD3;margin-right: 3px;"></span>
            <span style="font-size: 16px;font-weight: 500;">账户信息</span>

            <div class="shuaxin flex alc" @click="getInfo">
              <span class="el-icon-refresh-right"></span>
              <span class="font14">刷新</span>
            </div>
            <span class="shoukuanzhanghu" @click="openShoukuanzhanghu" v-if="checkPermi(['shd:home:shezhizhanghu'])">
              收款账户
            </span>
          </div>
          <div class="yue_box ">
            <div class="flex fbt">
              <div class="flex">
                <img src="../assets/img/home2/yueicon.png" alt="">
                <div>
                  <div class="color666">
                    账户余额
                  </div>
                  <div style="font-size: 18px;" v-if="checkPermi(['shd:home:xianshiyue'])">
                    {{ shopInfo.availableMoney||'--' }}
                  </div>
                  <div style="font-size: 18px;" v-else>
                    ****
                  </div>
                </div>

                <!-- <div style="margin-left: 20px;">
                  <div class="color666">
                    <el-popover placement="top-start" width="230" trigger="hover" title="待结算金额：" content="交易中的订单金额（已扣除支付渠道手续费）。订单完成后自动转到已结算。">
                      <div slot="reference">
                        <span>待结算</span>
                        <i style="cursor: pointer;margin-left: 3px;" class="el-icon-question"></i>
                      </div>

                    </el-popover>
                  </div>
                  <div @click="openDaijiesuanMX" style="font-size: 18px;color: red;cursor: pointer;" v-if="checkPermi(['shd:home:xianshiyue'])">
                    {{ hfyanchiye.balance_amt||'--' }}
                  </div>
                  <div style="font-size: 18px;" v-else>
                    ****
                  </div>
                </div>
                <div style="margin-left: 20px;">
                  <div class="color666">
                    <el-popover placement="top-start" title="已结算金额：" width="230" trigger="hover" content="完成订单结算的金额。将在下一个工作日自动提现，转为提现中。">
                      
                      <div slot="reference">
                        <span>已结算</span>
                        <i style="cursor: pointer;margin-left: 3px;" class="el-icon-question"></i>
                      </div>
                    </el-popover>
                  </div>
                  <div @click="openhuifuYEMX" style="font-size: 18px;color: yellowgreen;cursor: pointer;" v-if="checkPermi(['shd:home:xianshiyue'])">
                    {{ hfye.avl_bal||'--' }}
                  </div>
                  <div style="font-size: 18px;" v-else>
                    ****
                  </div>
                </div>

                <div style="margin-left: 20px;">
                  <div class="color666">
                    <el-popover placement="top-start" title="提现中金额：" width="230" trigger="hover" content="系统自动提现中的金额。将在下一个工作日到账银行账户。">
                      <div slot="reference">
                        <span>提现中</span>
                        <i style="cursor: pointer;margin-left: 3px;" class="el-icon-question"></i>
                      </div>

                    </el-popover>
                  </div>
                  <div @click="openTixianzhongMX" style="font-size: 18px;color: burlywood;cursor: pointer;" v-if="checkPermi(['shd:home:xianshiyue'])">
                    {{ hfTxz||'--' }}
                  </div>
                  <div style="font-size: 18px;" v-else>
                    ****
                  </div>
                </div> -->
              </div>

              <div class="btns flex" style="margin-top: 10px;justify-content: flex-end;">
                <el-button plain type="primary" size="mini" class="btn" @click="chongzhiyue" v-hasPermi="['shd:home:yudouchongzhi']">
                  <span class="icon"></span>
                  充值
                </el-button>
                <el-button type="primary" plain class="btn" size="mini" @click="tixianFn" v-hasPermi="['shd:home:tixian']">
                  <span class="icon"></span> 提现
                </el-button>
                <el-button plain v-hasPermi="['tenantPages:moneys']" type="primary" class="btn" size="mini" @click="goLinkName('Shop/moneys')">
                  余额明细
                </el-button>
                <!-- <el-button type="primary" plain class="btn" size="mini" @click="openHuifuJiaoyiMx" v-hasPermi="['tenantPages:moneys']">
                  交易流水
                </el-button> -->
                <!-- <el-button plain v-hasPermi="['tenantPages:moneys']" type="primary" class="btn" size="mini" @click="openhuifuYEMX">
                  自动提现余额明细
                </el-button> -->
              </div>
            </div>

            <div v-if="TIXIANING&&TIXIANING.type==1" style="color: #6C5DD3;font-size:12px;margin-top:5px;">您有一笔 <span style="color:red;font-size:18px">{{TIXIANING.applicantAmount}}</span> 元的提现正在进行中...</div>
          </div>
          <div class="yue_box flex fbt">
            <div class="flex">
              <img src="../assets/img/home2/yudouicon.png" alt="">
              <div>
                <div class="color666">
                  虞豆剩余
                </div>
                <div style="font-size: 18px;" v-if="checkPermi(['shd:home:xianshiyudou'])">
                  {{ shopInfo.campNumber||'0' }}
                </div>
                <div style="font-size: 18px;" v-else>
                  ****
                </div>
              </div>
            </div>
            <div class="btns">
              <el-button plain type="primary" size="mini" class="btn" @click="chongzhijifen" v-hasPermi="['shd:home:yudouchongzhi']">
                <span class="icon"></span>
                充值
              </el-button>
              <el-button plain v-hasPermi="['tenantPages/jifen']" type="primary" class="btn" size="mini" @click="goLinkName('TenantPages/jifen')">
                虞豆明细
              </el-button>
            </div>
          </div>
          <!-- 短信余量 -->
          <div class="yue_box flex fbt">
            <div class="flex">
              <img src="../assets/img/home2/smsicon.png" alt="">
              <div>
                <div class="color666">
                  系统短信
                </div>
                <div style="font-size: 14px;" v-if="checkPermi(['shd:home:xianshiyudou'])">
                  <span>免费短信:{{ shopInfo.smsSystemNum }}</span>
                  <span style="margin-left: 15px;">短信包:{{ shopInfo.smsPackageNum }}</span>
                </div>
                <div style="font-size: 18px;" v-else>
                  ****
                </div>
              </div>
            </div>
            <div class="btns">
              <el-button plain type="primary" size="mini" class="btn" @click="smsChongzhiOpen" v-hasPermi="['shd:home:yudouchongzhi']">
                <span class="icon"></span>
                充值
              </el-button>
              <el-button plain v-hasPermi="['tenantPages/jifen']" type="primary" class="btn" size="mini" @click="openSmsMingxi">
                短信明细
              </el-button>
            </div>
          </div>
          <div class="yue_box ">
            <div class="flex fbt">
              <div class="flex">
                <img src="../assets/img/home2/baozhengjinicon.png" alt="">
                <div>
                  <div class="color666">
                    保证金
                  </div>
                  <div style="font-size: 18px;">
                    {{ shopInfo.marginMoney||'0.00' }}
                  </div>
                </div>
              </div>
              <div class="btns">
                <el-button plain type="primary" size="mini" @click="openPayBZJ" v-if="shopInfo.marginState!=2&&!(TIXIANING&&TIXIANING.type==2)">缴纳保证金</el-button>
                <el-button plain type="primary" size="mini" @click="openPayBZJ" v-if="shopInfo.marginState==2&&shopInfo.marginMoney<BZJmoney">缴纳保证金</el-button>
                <el-button v-hasPermi="['shd:home:tixian']" type="primary" size="mini" @click="openTixian" :disabled="shopInfo.marginState!=2||shopInfo.marginMoney<=0">提现</el-button>
                <el-button plain type="primary" size="mini" @click="openBZJOrder">保证金明细</el-button>
              </div>
            </div>

            <div v-if="TIXIANING&&TIXIANING.type==2" style="color: #6C5DD3;font-size:12px;margin-top:5px;">您有一笔 <span style="color:red;font-size:18px">{{TIXIANING.applicantAmount}}</span> 元的提现正在进行中...</div>
          </div>

        </div>
        <div class="daiban card">
          <subtit title="待办事项"></subtit>
          <div class="daiban_inner flex">
            <div class="daiban_item" @click="goLink('/tenantGoods/goodsManage',{type:'myAccount',saleState:5},'goodsManage',true)">
              <el-badge :hidden="daibanData.wenti==0" :max="99" :value="daibanData.wenti" class="item">
                <img src="../assets/img/home2/wentiicon.png" alt="">
              </el-badge>
              <div>问题商品</div>
            </div>
            <div class="daiban_item" @click="goLink('/tenantOrders/SaleAfterOrder','','afterOrderForTenant:afterOrderList',true)">
              <el-badge :hidden="daibanData.shouhou==0" :max="99" :value="daibanData.shouhou" class="item">
                <img src="../assets/img/home2/shouhouicon.png" alt="">
              </el-badge>
              <div>售后处理</div>
            </div>
            <div class="daiban_item" @click="goLink('/tenantUtils/jiankongfenzu','','jiankongfenzu',true)">
              <el-badge :hidden="daibanData.jiankong==0" :max="99" :value="daibanData.jiankong" class="item">
                <img src="../assets/img/home2/jiankongicon.png" alt="">
              </el-badge>
              <div>找回监控</div>
            </div>
            <div class="daiban_item" @click="goLink('/tenantGoods/goodsManage',{type:'myAccount',unsoldDays:'30'},'goodsManage',true)">
              <el-badge :hidden="daibanData.zhixiao==0" :max="99" :value="daibanData.zhixiao" class="item">
                <img src="../assets/img/home2/zhixiaoicon.png" alt="">
              </el-badge>
              <div>滞销商品</div>
            </div>

            <div class="daiban_item" @click="goLink('/tenantPages/finance/billAudit','','',true)">
              <el-badge :hidden="daibanData.daiheyanCount==0" :max="99" :value="daibanData.daiheyanCount" class="item">
                <img src="../assets/img/home2/heyan.png" alt="">
              </el-badge>
              <div>账单核验</div>
            </div>

          </div>

        </div>
        <div class="gonggao_box card">
          <subtit title="公告通知"></subtit>
          <div class="gonggao_inner">
            <img @click="openNotice(gonggaoList[0])" v-if="gonggaoList&&gonggaoList.length" style="width: 100%;height: 138px;cursor: pointer;border-radius: 8px;" :src="gonggaoList[0].titleImg" alt="">
            <div class="gonggao_list">
              <div class="gonggaoitem flex" v-for="item in gonggaoList" :key="item.noticeId" @click="openNotice(item)">
                <i class="icon"></i>
                <span class="title">
                  {{ item.noticeTitle }}
                </span>
              </div>
              <!-- <div class="gonggaoitem flex">
                <i class="icon"></i>
                <span>
                  这里是内容这里是内容这里是内容这里是内容这里是内容这里…
                </span>
              </div> -->
            </div>

          </div>
        </div>

      </div>
      <chongzhi ref="chongzhi"></chongzhi>
      <smsChongzhi ref="smsChongzhi"></smsChongzhi>
      <Lianxiwomen ref="Lianxiwomen"></Lianxiwomen>
      <payBZJ ref="payBZJ"></payBZJ>
      <BZJmingxi ref="BZJmingxi"></BZJmingxi>
      <tixian ref="tixian"></tixian>
      <authDialog ref="authDialog"></authDialog>
      <addBankcardDialog ref="addBankcardDialog" @openAuthDialog="openAuth"></addBankcardDialog>
      <userInfoSure ref="userInfoSure"></userInfoSure>
      <userInfoSure ref="userInfoSure"></userInfoSure>
      <zhibiaoAdd ref="zhibiaoAdd" @saveSuccess="saveSuccess"></zhibiaoAdd>
      <noticeDetailDialog ref="noticeDetailDialog"></noticeDetailDialog>
      <haibaoDialog ref="haibaoDialog"></haibaoDialog>
      <customApps ref="customApps" @saveSuccess="getZhidingApps"></customApps>

    </div>
    <!-- 管理员的首页 -->
    <div v-else-if="checkPermi(['searchTenantID'])" style="font-size:24px">
      <h2>破晓余额： <span style="font-weight:bold;color: blue;">{{poxiaoyue}}</span></h2>
      <!-- <el-button type="primary" @click="testAES">测试加密</el-button> -->
      <el-row :gutter="20">
        <el-col :span="12">
          <el-card class="update-log">
            <div slot="header" class="clearfix">
              <span>商家商品统计</span>
            </div>
            <div class="table_box">
              <el-table border stripe :data="supplerGoodsTotal" height="500">
                <el-table-column prop="tenant_name" label="商家名称">
                </el-table-column>
                <el-table-column prop="cot" label="商品数量">
                </el-table-column>
              </el-table>
            </div>
          </el-card>
        </el-col>
        <el-col :span="12">
          <el-card class="update-log">
            <div slot="header" class="clearfix">
              <span>商家昨日上新统计</span>
            </div>
            <div class="table_box">
              <!-- <div style="margin:10px 0">
                <el-date-picker style="width:215px" size="small" v-model="timer" type="daterange" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" format="yyyy-MM-dd" value-format="yyyy-MM-dd" @change="timerChange">
                </el-date-picker>
              </div> -->
              <el-table border stripe :data="supplerGoodsYesterday" height="500">
                <el-table-column prop="tenant_name" label="商家名称">
                </el-table-column>
                <el-table-column prop="cot" label="昨日上新">
                </el-table-column>
              </el-table>
            </div>
          </el-card>
        </el-col>

      </el-row>
      <el-row style="margin-top:15px" :gutter="20">
        <el-col :span="12">
          <el-card class="update-log">
            <div slot="header" class="clearfix">
              <span>商家虞豆统计</span>
            </div>
            <div class="table_box">
              <el-table @sort-change="yudouSortChange" border stripe :data="yudouList" height="500">
                <el-table-column prop="tenantName" label="商家名称">
                </el-table-column>
                <el-table-column sort-by sortable="custom" prop="tenantcampNumber" label="当前虞豆"></el-table-column>

                <el-table-column sort-by sortable="custom" prop="sumXHCampNumber" label="总消耗虞豆"></el-table-column>
                <el-table-column sort-by sortable="custom" prop="sumCZCampNumber" label="总充值虞豆"></el-table-column>

              </el-table>
            </div>
          </el-card>
        </el-col>
        <el-col :span="12">
          <el-card class="update-log">
            <div slot="header" class="clearfix">
              <span>商家注册用户统计</span>
            </div>
            <div class="table_box">
              <el-table border stripe :data="supplerUserTotal" height="500">
                <el-table-column prop="tenant_name" label="商家名称">
                </el-table-column>
                <el-table-column prop="cot" label="注册用户">
                </el-table-column>
              </el-table>
            </div>
          </el-card>
        </el-col>

      </el-row>
      <el-row style="margin-top:15px" :gutter="20">
        <el-col :span="12">
          <el-card class="update-log">
            <div slot="header" class="clearfix">
              <span>消费虞豆类型统计</span>
            </div>
            <div class="table_box">
              <el-table @sort-change="yudouTypeTableChange" border stripe :data="moduleYudouList" height="500">
                <el-table-column prop="tenantName" label="虞豆类型">
                  <template slot-scope="scope">
                    <el-tag :type="commonMaps.jifenTypeMap[scope.row.msg_type].type">{{ commonMaps.jifenTypeMap[scope.row.msg_type].label }}</el-tag>
                  </template>
                </el-table-column>
                <el-table-column sort-by sortable="custom" prop="cot" label="变动次数"></el-table-column>
                <el-table-column sort-by sortable="custom" prop="sum" label="虞豆数量"></el-table-column>
                <!-- <el-table-column sort-by sortable="custom" prop="sumCZCampNumber" label="总充值虞豆"></el-table-column> -->
              </el-table>
            </div>
          </el-card>
        </el-col>
        <el-col :span="12">
          <!-- <el-card class="update-log">
            <div slot="header" class="clearfix">
              <span>商家注册用户统计</span>
            </div>
            <div class="table_box">
              <el-table border stripe :data="supplerUserTotal" height="500">
                <el-table-column prop="tenant_name" label="商家名称">
                </el-table-column>
                <el-table-column prop="cot" label="注册用户">
                </el-table-column>
              </el-table>
            </div>
          </el-card> -->
        </el-col>

      </el-row>
    </div>
    <div v-else style="color:#666;font-size:30px;text-align:center;line-height:300px">
      欢迎使用 虞都互联~
    </div>

    <editShopInfo ref="editShopInfo"></editShopInfo>
    <!-- 联系对方 -->
    <kefuList ref="kefuList"></kefuList>
    <!-- 代售我的商家 -->
    <el-dialog title="代售我的商家" close-on-click-modal :visible.sync="daishouwodeShow" width="960px">
      <div style="margin-bottom:15px;font-size:16px;text-align:center;line-height:30px">
        <el-table border stripe :data="daishouwode">
          <!-- <el-table-column type="selection" width="55">
            </el-table-column> -->
          <el-table-column align="center" label="商家" prop="tenantName">
          </el-table-column>
          <el-table-column align="center" label="代售游戏" prop="gameNames" />
        </el-table>
      </div>

    </el-dialog>

    <!-- 短信明细 -->
    <smsMingxi ref="smsMingxi"></smsMingxi>
    <!-- 汇付余额明细 -->
    <huifuYEMX ref="huifuYEMX"></huifuYEMX>
    <!-- 待结算明细 -->
    <daijiesuanMX ref="daijiesuanMX"></daijiesuanMX>
    <!-- 汇付提现明细 -->
    <huifuTixianMx ref="huifuTixianMx"></huifuTixianMx>
    <!-- 汇付交易流水 -->
    <huifuJiaoyiMx ref="huifuJiaoyiMx"></huifuJiaoyiMx>
    <!-- 充值余额 -->
    <chongzhiYue ref="chongzhiYue"></chongzhiYue>

    <!-- 提号选择类型 -->
    <pickUpType ref="pickUpType"></pickUpType>
    <!-- 创建回收订单 -->
    <createBackOrderCustom ref="createBackOrderCustom" @addSuccess="addSuccess('huishou')"></createBackOrderCustom>
    <!-- 创建销售订单 -->
    <createSaleOrderCustom ref="createSaleOrderCustom" @addSuccess="addSuccess('xiaoshou')"></createSaleOrderCustom>
    <!-- 创建日常收支 -->
    <jizhangbenAdd ref="jizhangbenAdd" @addSuccess="addSuccess('richang')"></jizhangbenAdd>
    <!-- 发布商品 -->
     <addAndEditGoods ref="addAndEditGoods" @success="addSuccess('fabu')"></addAndEditGoods>
  </div>
</template>
<script>
import subtit from "@/components/indexComponents/subtit.vue";
import orderByDayBar from "@/components/indexComponents/orderByDayBar.vue";
import orderByPerson from "@/components/indexComponents/orderByPerson.vue";
import orderAmountByGame from "@/components/indexComponents/orderAmountByGame.vue";
import zhuceByDay from "@/components/indexComponents/zhuceByDay.vue";

import chongzhi from "./tenantPages/moneys/components/chongzhijifen.vue";
import smsChongzhi from "./tenantPages/moneys/components/smsChongzhi.vue";
import chongzhiYue from "./tenantPages/moneys/components/chongzhiYue.vue";
import valueAddedServices from "@/api/shanghuduan/valueAddedServices";
import {
  hfBalanceQuery,
  settlementQueryMx,
} from "../api/tenantApis/tenantManage";
import {
  saleOrderNum,
  goodsStatebyGame,
  goodsCountByTenant,
  yudouCountByTenant,
  getKucunNum,
  monitorTaskErr,
  getSupplerUserTotal,
  getModuleYudou,
  getdaibanshixiang,
  getZaishoushangpin,
  getwomaide1,
  getwomaide2,
  gethuliantongji,
  getuserDataList,
  getgetUserDate,
} from "@/api/tenantApis/indexStatistics.js";

import resourcesManage from "@/api/PCWebImages/resourcesManage";
import Lianxiwomen from "@/components/ConsignmentFourzero/lianxiwomen.vue";
import checkPhoneApi from "@/api/gameConfig/checkPhonePx";
import { formatDate } from "@/utils/index";
import haibaoDialog from "@/views/tenantPages/shopManage/shopCenter/haibaoDialog.vue";
import kefuList from "@/components/common/kefuList.vue";

import myMoneyApi from "@/api/financeCenter/myMoney.js";
import payBZJ from "@/views/tenantPages/moneys/components/payBZJ.vue";
import BZJmingxi from "@/views/tenantPages/moneys/components/BZJmingxi";
import tixian from "@/views/tenantPages/moneys/components/tixian.vue";
import authDialog from "@/views/tenantPages/shopManage/shopCenter/authDialog";
import addBankcardDialog from "@/views/tenantPages/shopManage/shopCenter/addBankcardDialog.vue";
import userInfoSure from "@/views/tenantPages/components/userInfoSure.vue";
import editShopInfo from "../components/common/editShopInfo.vue";

import zhibiaoAdd from "../components/indexComponents/zhibiaoAdd.vue";

import { getsystemNotice } from "@/api/system/notice";

import noticeDetailDialog from "../components/common/noticeDetailDialog.vue";
import customApps from "../components/indexComponents/customApps.vue";

import goodsListApi from "@/api/gameConfig/goodsList";

import smsMingxi from "./tenantPages/moneys/components/smsMingxi.vue";
import daijiesuanMX from "./tenantPages/moneys/components/daijiesuanMX.vue";

import huifuYEMX from "./tenantPages/moneys/components/huifuYEMX.vue";
import huifuTixianMx from "./tenantPages/moneys/components/huifuTixianMx.vue";
import huifuJiaoyiMx from "./tenantPages/moneys/components/huifuJiaoyiMx.vue";

// 数据创建相关
import pickUpType from "../components/indexComponents/pickUpType.vue";
import createBackOrderCustom from "./tenantPages/recycleManage/recycleOrders/createOrderCustom.vue";
import createSaleOrderCustom from "./tenantPages/saleOrder/components/createSaleOrderCustom.vue";
import jizhangbenAdd from "./tenantPages/tools/jizhangben/add.vue";
import addAndEditGoods from "./tenantPages/goodsList/addAndEdit.vue";
export default {
  components: {
    subtit,
    orderByDayBar,
    orderByPerson,
    orderAmountByGame,
    zhuceByDay,
    chongzhi,
    Lianxiwomen,
    haibaoDialog,
    kefuList,
    customApps,
    smsChongzhi,

    chongzhiYue,
    payBZJ,
    BZJmingxi,
    tixian,
    authDialog,
    addBankcardDialog,
    userInfoSure,
    editShopInfo,
    zhibiaoAdd,
    noticeDetailDialog,
    smsMingxi,
    huifuYEMX,
    daijiesuanMX,
    huifuTixianMx,
    huifuJiaoyiMx,

    // 数据创建相关
    pickUpType,
    createBackOrderCustom,
    createSaleOrderCustom,
    jizhangbenAdd,
    addAndEditGoods
  },
  name:'',
  data() {
    return {
      daishouwodeShow: false,
      daishouwode: [],
      shalou: require("../assets/img/home2/shalou.png"),
      daibanData: {
        wenti: 0,
        shouhou: 0,
        jiankong: 0,
        zhixiao: 0,
        daiheyanCount: 0,
      },
      BZJmoney: "",
      BZJdes: "",
      TIXIANING: "",
      goodsNum: "0",
      sellData: {
        jiaoyizhong: 0,
        shouhou: 0,
        wancheng: 0,
      },
      buyData: {
        jiaoyizhong: 0,
        shouhou: 0,
        wancheng: 0,
      },
      shopData: [],
      tongjiData: {
        0: {
          label: "竞拍市场已成交",
          value1: "0",
          value2: "122",
          icon: require("../assets/img/home2/jpscycj.png"),
          link: "/huoyuan/jingpailiebiao",
          permiStr: "jingpai:list",
        },
        1: {
          label: "商家互提已成交",
          value1: "0",
          value2: "122",
          icon: require("../assets/img/home2/sjhtycj.png"),
          link: "",
        },
        2: {
          label: "竞拍市场等您报价",
          value1: "0",
          value2: "122",
          icon: require("../assets/img/home2/jpscdnbj.png"),
          link: "/huoyuan/jingpailiebiao",
          permiStr: "jingpai:list",
        },
        3: {
          label: "商家正在代售您的商品",
          value1: "0",
          value2: "122",
          icon: require("../assets/img/home2/dsnspdsj.png"),
          link: "daishouwode",
        },
      },
      gonggaoList: [],

      poxiaoyue: "",
      orderTotalNums: {},
      // goodsNums: {},
      queryParams: {
        gameId: "",
      },
      daoqiFuwu: [],
      serviceList: [],
      lunboList: [],
      // 以下是管理端数据
      supplerGoodsTotal: [],
      supplerUserTotal: [],
      supplerGoodsYesterday: [],
      timer: [],

      yudouList: [],
      yudouParams: {
        sortColumn: "",
        sort: "",
      },
      monitorTaskErrNum: {},
      moduleYudouList: [],
      yudouTypeParams: {
        sortColumn: "",
        sort: "",
      },

      myApps: [],
      quickApps: [],
      hfye: {}, //汇付基本户账户资金详情
      hfyanchiye: {}, //汇付延迟户账户资金详情
      hfTxz: "", //汇付提现中

      createQuick: [
        {
          name: "回收单",
          key: "huishou",
          index: 1,
          bg: "https://imgage.maimaihao.com/yuduhulian/erp/static/img/huishoudan2.png",
          permi:"backOrder:add"
        },
        {
          name: "销售单",
          key: "xiaoshou",
          index: 2,
          bg: "https://imgage.maimaihao.com/yuduhulian/erp/static/img/xiaoshoudan.png",
          permi:"orderForTenant:addOrder"
        },
        {
          name: "日常支出",
          key: "rczc",
          index: 3,
          bg: "https://imgage.maimaihao.com/yuduhulian/erp/static/img/richangzhichu.png",
          permi:"jizhangben:add"
        },
        {
          name: "日常收入",
          key: "rcsr",
          index: 4,
          bg: "https://imgage.maimaihao.com/yuduhulian/erp/static/img/richangshouru.png",
          permi:"jizhangben:add"
        },
        {
          name: "商品发布",
          key: "spfb",
          index: 5,
          bg: "https://imgage.maimaihao.com/yuduhulian/erp/static/img/shangpinfabu.png",
          permi:"goods:list:release"
        },
        {
          name: "去提号",
          key: "qutihao",
          index: 6,
          bg: "https://imgage.maimaihao.com/yuduhulian/erp/static/img/qutihao.png",
          permi:""
        },
      ],
    };
  },
  computed: {
    userInfo() {
      return this.$store.getters.userInfo;
    },
    shopInfo() {
      return this.$store.getters.shopInfo;
    },
    allGameList() {
      return this.$store.getters.allGameList;
    },
    getBaifenbi() {
      return (num, total) => {
        const baifen = (num / (total || 1)) * 100;
        return Math.round(baifen);
      };
    },
    routeData() {
      return this.$store.state.permission.routeData;
    },
  },
  watch: {
    userInfo: {
      handler(val) {
        this.getErpVer();
        if (val.tenantId != 1) {
          // 这是商户
          this.getBZJ();
          this.getDaiban();
          this.getGoodsNum();
          this.getMyBuyNums();
          this.getMySellNums();
          this.gethuliantongjiFn();
          this.getUserShopDatas();
          this.getGonggao();
          this.getTixianing();
          // this.getHfye();
          // this.getHfTixian();
        } else {
          // 这是管理员
          this.getpoxiao();
          this.initByAdmin();
        }
      },
      immediate: true,
      deep: true,
    },
    routeData: {
      handler(val) {
        if (val && val.length) {
          this.myApps = this.extractItemsWithoutChildren(val);
          // console.log("%c Line:654 🍭 this.myApps", "color:#ea7e5c", this.myApps);
          this.getZhidingApps();
        }
      },
      immediate: true,
      deep: true,
    },
  },
  created() {
    if (this.shopInfo && this.shopInfo.tenantId) {
      this.$store.dispatch("getShopInfo", this.shopInfo.tenantId);
    }
  },
  mounted(){
    this.$nextTick(()=>{
      if(this.$route.query){
        // console.log("%c Line:932 🌰 this.$route.query", "color:#93c0a4", this.$route);

      }
    })
  },
  methods: {
    // 点击创建数据的按钮
    createOrder(item) {
      // console.log("%c Line:910 🍫 item", "color:#6ec1c2", item);
      if(item.permi&&!this.checkPermi([item.permi])){
        return this.$message.error('没有操作权限，请联系管理员分配权限！')
      }

      if (item.key == "huishou") {
        // 创建回收单
        this.$refs.createBackOrderCustom.open();
      } else if (item.key == "qutihao") {
        // 提号按钮
        this.$refs.pickUpType.open();
      } else if (item.key == "xiaoshou") {
        // 创建销售单
        this.$refs.createSaleOrderCustom.open();
      } else if (item.key == "rczc") {
        // 日常支出
        this.$refs.jizhangbenAdd.open(2);
      }else if (item.key == "rcsr") {
        // 日常收入
        this.$refs.jizhangbenAdd.open(1);
      }else if (item.key == "spfb") {
        // 商品发布
        this.$refs.addAndEditGoods.open('add');
      }
      
    },
    // 创建数据完成后跳转
   
     addSuccess(type){
      if(type=='huishou'){
        this.goLink('/recycleManage/recycleOrdersmyBuy',{orderStatus:4},'',true)
      }else if(type=='xiaoshou'){
        this.goLink('/tenantOrders/SaleOrderPage',{orderStatus:1},'orderForTenant:orderList',true)
      }else if(type=='richang'){
        this.goLink('/tenantPages/finance/jizhangben',null,'',true)
      }else if(type=='fabu'){
        this.goLink('/tenantGoods/goodsManage',{type:'myAccount'},'',true)
      }
     },
    // 获取erp版本号
    // 获取保证金金额
    getErpVer() {
      const localVer = localStorage.getItem("erp_ver");
      this.getDicts("ver").then((r) => {
        if (r.data && r.data.length) {
          const obj = this.arrayToObject(r.data, "dictLabel");
          localStorage.setItem("erp_ver", obj.erp_ver.dictValue);
          if (!localVer || Number(localVer) < Number(obj.erp_ver.dictValue)) {
            // 本地没有版本号或者本地版本小于服务端时 重新加载页面
            location.reload(true); // 强制从服务器重新加载
            console.log("%c Line:847 🥕 强制从服务器重新加载", "color:#e41a6a");
          }
        } else {
          localStorage.setItem("erp_ver", 1);
          if (!localVer) {
            // 本地没有版本号或者本地版本小于服务端时 重新加载页面
            location.reload(true); // 强制从服务器重新加载
            console.log("%c Line:847 🥕 强制从服务器重新加载", "color:#e41a6a");
          }
        }
      });
    },
    // 获取汇付余额
    getHfye() {
      hfBalanceQuery().then((res) => {
        if (res.msg && JSON.parse(res.msg).msg) {
          const obj = JSON.parse(JSON.parse(res.msg).msg);
          if (obj.acctInfo_list) {
            const arr = JSON.parse(obj.acctInfo_list);
            if (arr && arr.length) {
              arr.map((item) => {
                if (item.acct_type == "01") {
                  // 基本户
                  this.hfye = { ...item };
                } else if (item.acct_type == "03") {
                  // 延迟户
                  this.hfyanchiye = { ...item };
                }
              });
            }
          }
        }
      });
    },
    // 获取汇付提现记录
    getHfTixian() {
      const obj = {
        pageSize: 10,
        pageNum: 1,
        beginDate: "",
        endDate: "",
      };
      const now = new Date();
      const year = now.getFullYear();
      const month = now.getMonth() + 1;
      const day = now.getDate();

      // 获取当前日期
      let currentDate = new Date();
      // 获取七天前的日期
      currentDate.setDate(currentDate.getDate() - 7);
      const year2 = currentDate.getFullYear();
      const month2 = currentDate.getMonth() + 1;
      const day2 = currentDate.getDate();

      const startDate = `${year2}${month2 > 9 ? month2 : "0" + month2}${
        day2 > 9 ? day2 : "0" + day2
      }`;
      const endDate = `${year}${month > 9 ? month : "0" + month}${
        day > 9 ? day : "0" + day
      }`;
      obj.beginDate = startDate;
      obj.endDate = endDate;
      this.hfTxz = 0;
      settlementQueryMx(obj).then((res) => {
        if (res.data && res.data.data && res.data.data.trans_log_result_list) {
          const arr = JSON.parse(res.data.data.trans_log_result_list);
          if (arr.length) {
            arr.forEach((i) => {
              if (i.trans_stat == "I" || i.trans_stat == "P") {
                this.hfTxz = this.hfTxz + Number(i.trans_amt);
              }
            });
            if (!this.hfTxz || this.hfTxz === 0) this.hfTxz = "0.00";
          }
        }
      });
    },

    // 获取代售我的商家列表
    getDaishouwode() {
      goodsListApi.getDaishouwode().then((res) => {
        this.daishouwode = res.data;
        this.daishouwodeShow = true;
      });
    },

    // 打开收款账户
    openShoukuanzhanghu() {
      this.$refs.addBankcardDialog.open();
    },
    // 打开认证弹窗
    openAuth() {
      this.$refs.authDialog.open();
    },
    // 打开通知公告详情
    openNotice(item) {
      this.$refs.noticeDetailDialog.open(item);
    },
    // 获取商户端通知公告
    getGonggao() {
      const homeNoticeId = localStorage.getItem("homeNoticeId");
      getsystemNotice({
        noticeType: "sjdtzgg",
      }).then((response) => {
        if (response.data && response.data.length > 0) {
          this.gonggaoList = response.data;
          if (this.gonggaoList.length > 8) this.gonggaoList.length = 8;
          // 新公告首次进入首页时直接打开
          if (
            this.gonggaoList.length > 0 &&
            (!homeNoticeId || homeNoticeId < this.gonggaoList[0].noticeId)
          ) {
            this.openNotice(this.gonggaoList[0]);
            localStorage.setItem("homeNoticeId", this.gonggaoList[0].noticeId);
          }
        }
      });
    },
    // 菜单跳转
    goRoute(item) {
      // console.log("%c Line:667 🍺 item", "color:#465975", item);
      if (item.meta.link) {
        window.open(item.meta.link);
      } else {
        let query = "";
        if (item.query) {
          query = JSON.parse(item.query);
        }
        this.$router.push({
          path: item.path2,
          query: query || null,
        });
      }
    },
    //我的应用 递归取出所有子菜单
    extractItemsWithoutChildren(data) {
      let result = [];

      // 递归函数
      function recurse(items, currentPath) {
        for (let item of items) {
          const itemPath = `${currentPath}${
            item.path[0] == "/" ||
            (currentPath && currentPath[currentPath.length - 1] == "/")
              ? ""
              : "/"
          }${item.path}`;
          if (!item.children || item.children.length === 0) {
            // 创建对象副本并设置path字段
            if (!item.hidden) {
              result.push({ ...item, path2: itemPath });
            }
          } else {
            recurse(item.children, itemPath);
          }
        }
      }

      // 从根数据开始递归，根级项的path以'/'开头
      recurse(data, "");

      return result;
    },
    // 获取自定义置顶应用
    getZhidingApps() {
      this.quickApps = [];
      getuserDataList({ type: 2 })
        .then((res) => {
          let apps = [];
          if (res.rows && res.rows.length && this.myApps.length) {
            res.rows.forEach((r) => {
              // console.log("%c Line:673 🍡 r", "color:#6ec1c2", r.dataKey);
              // if (this.commonMaps.shopDataMap[r.dataKey]) {
              //   shopDatas.push(this.commonMaps.shopDataMap[r.dataKey]);
              // }
              this.myApps.forEach((r2) => {
                if (r2.name && r2.name == r.dataKey) {
                  apps.push(r2);
                }
              });
            });
            this.quickApps = [...apps];
          } else {
            // 没有自定义 ,展示全部
            this.quickApps = [...this.myApps];
            if (this.quickApps.length > 10) this.quickApps.length = 10;
          }
        })
        .catch((err) => {});
    },
    // 打开我的应用
    openAddApps() {
      this.$refs.customApps.open(this.quickApps, this.routeData);
    },
    // 打开新增指标弹出框
    openAddZhibiao() {
      this.$refs.zhibiaoAdd.open(this.shopData);
    },
    //自定义指标完成
    saveSuccess() {
      this.getUserShopDatas();
    },
    // 获取自定义店铺数据统计项
    getUserShopDatas() {
      getuserDataList({ type: 1 })
        .then((res) => {
          let shopDatas = [];
          if (res.rows && res.rows.length) {
            res.rows.forEach((r) => {
              // console.log("%c Line:673 🍡 r", "color:#6ec1c2", r.dataKey);
              if (this.commonMaps.shopDataMap[r.dataKey]) {
                shopDatas.push(this.commonMaps.shopDataMap[r.dataKey]);
              }
            });
          } else {
            // 没有自定义  取默认值
            // map转数组
            shopDatas = Object.values(this.commonMaps.shopDataMap);

            shopDatas.length = 4;
          }
          this.getUserShopDataValues(shopDatas);
        })
        .catch((err) => {});
    },
    // 获取自定义数据项的统计值
    getUserShopDataValues(shopDatas) {
      let keys = [];
      if (shopDatas && shopDatas.length) {
        shopDatas.forEach((r) => {
          // 判断权限
          if (this.checkPermi([`shd:home:${r.key}`])) {
            keys.push(r.key);
          }
        });
        // keys
        // console.log("%c Line:1236 🍧 keys", "color:#42b983", keys);
        getgetUserDate({
          dataKeys: keys,
        }).then((res) => {
          // console.log("%c Line:710 🍏获  取自定义数据项的统计值 res", "color:#ed9ec7", res);

          shopDatas.forEach((r) => {
            if (res.data[r.key] && res.data[r.key].length) {
              if (res.data[r.key].length == 2) {
                r.value1 = res.data[r.key][0];
                r.value2 = res.data[r.key][1];
              } else if (res.data[r.key].length == 3) {
                r.value1 = res.data[r.key][0];
                r.value2 = res.data[r.key][1];
                r.value3 = res.data[r.key][2];
              }
              if(r.key=='huoyueyonghu'&&res.data[r.key].length==1){
                r.value2 = res.data[r.key][0];
              }
            } else {
              r.value1 = "***";
              r.value2 = "***";
              r.value3 = "***";
            }
          });
          this.shopData = shopDatas;
        });
      }
    },

    // 获取在售商品数量
    getGoodsNum() {
      if (this.checkPermi(["shd:home:shangpin"])) {
        getZaishoushangpin().then((res) => {
          // console.log("%c Line:653 🥛 getZaishoushangpinres", "color:#2eafb0", res);
          this.goodsNum = res.data.zaishou || 0;
        });
      }
    },
    // 获取我买的数量
    getMyBuyNums() {
      if (this.checkPermi(["shd:home:huishoutongji"])) {
        getwomaide2().then((res) => {
          // console.log("%c Line:653 🥛getwomaide2 res", "color:#2eafb0", res);
          this.buyData.jiaoyizhong = res.data.jiaoyizhong || 0;
          this.buyData.shouhou = res.data.shouhou || 0;
          this.buyData.wancheng = res.data.wancheng || 0;
        });
      }
    },
    // 获取我卖的数量
    getMySellNums() {
      if (this.checkPermi(["shd:home:xiaoshoutongji"])) {
        getwomaide1().then((res) => {
          // console.log("%c Line:653 🥛getwomaide1 res", "color:#2eafb0", res);
          this.sellData.jiaoyizhong = res.data.jiaoyizhong || 0;
          this.sellData.shouhou = res.data.shouhou || 0;
          this.sellData.wancheng = res.data.wancheng || 0;
        });
      }
    },
    // 获取数据统计
    gethuliantongjiFn() {
      gethuliantongji().then((res) => {
        this.tongjiData[0].value1 = res.data.jingjiachengjiao || 0;

        this.tongjiData[2].value1 = res.data.daibaojia || 0;
        this.tongjiData[3].value1 = res.data.daishouwode || 0;
      });
    },
    // 点击修改资料
    editShopInfoFn() {
      this.$refs.editShopInfo.open();
    },
    // 获取代办事项数量
    getDaiban() {
      getdaibanshixiang().then((res) => {
        // console.log("%c Line:499 🍧 res", "color:#f5ce50", res);
        this.daibanData.wenti = res.data.problemCount;
        this.daibanData.zhixiao = res.data.unsoldCount;
        this.daibanData.jiankong = res.data.zhaohuijiankong;
        this.daibanData.shouhou = res.data.xssh || 0;
        this.daibanData.daiheyanCount = res.data.daiheyanCount || 0;
      });
    },
    getInfo() {
      this.$store.dispatch("getShopInfo", this.userInfo.tenantId);
      this.getTixianing();
      this.getHfye();
      this.getHfTixian();
    },

    // 点击提现按钮
    tixianFn() {
      if (
        this.shopInfo.marginState == 2 &&
        this.shopInfo.marginMoney < this.BZJmoney
      ) {
        this.$message.error("保证金不足，请缴纳保证金后再提现！");
        return;
      }
      this.$refs.tixian.open(null);
    },
    mingxi(path) {
      console.log("%c Line:878 🥪 path", "color:#b03734", path);
      this.$router.push({
        path: path,
      });
    },
    // 获取保证金金额
    getBZJ() {
      this.getDicts("marginMoney").then((res) => {
        //console.log("%c Line:271 🥕 res", "color:#42b983", res);
        if (res.data && res.data.length) {
          this.BZJmoney = res.data[0].dictValue;
          this.BZJdes = res.data[0].remark
            ? res.data[0].remark.replace(/\n/g, "<br/>")
            : "";
        }
      });
    },
    // 签署入驻合同
    signFdd() {
      this.$refs.userInfoSure.open();
    },
    // 法大大认证
    fadadaAuth() {
      tenantqiyerenzheng({
        tenantId: this.userInfo.tenantId,
      }).then((res) => {
        // console.log("%c Line:276 🍺 res", "color:#6ec1c2", res);
        if (res.msg && res.msg.incluse("http")) {
          window.open(res.msg);
          this.$alert("认证完成请点击确认！");
          this.$store.dispatch("getShopInfo", this.form.tenantId);
        }
      });
    },
    // 查询是否有正在提现的记录
    getTixianing() {
      myMoneyApi
        .withdrawalRecordList({ pageNum: 1, pageSize: 3, state: 1 })
        .then((res) => {
          if (res && res.rows.length && res.rows[0].state == 1) {
            this.TIXIANING = res.rows[0];
          } else {
            this.TIXIANING = "";
          }
        });
    },
    //  openDaijiesuanMX 打开待结算明细
    openDaijiesuanMX() {
      this.$refs.daijiesuanMX.open();
    },
    // 打开短信明细
    openSmsMingxi() {
      this.$refs.smsMingxi.open();
    },
    // 打开汇付余额明细
    openhuifuYEMX() {
      this.$refs.huifuYEMX.open();
    },
    //  打开汇付提现中明细
    openTixianzhongMX() {
      this.$refs.huifuTixianMx.open();
    },
    //  打开汇付交易明细
    openHuifuJiaoyiMx() {
      this.$refs.huifuJiaoyiMx.open();
    },
    // 打开缴纳保证金的窗口
    openPayBZJ() {
      const money =
        Math.round((this.BZJmoney - this.shopInfo.marginMoney) * 100) / 100;
      this.$refs.payBZJ.open(money, this.BZJmoney || 0);
    },
    // 打开保证金明细
    openBZJOrder() {
      this.$refs.BZJmingxi.open();
    },
    // 保证金提现
    openTixian() {
      this.$store.dispatch("getShopInfo");
      this.$refs.tixian.open(null, "bzj");
    },

    // 打开客服弹窗
    openIm(id) {
      this.$refs.kefuList.open(id, 1);
    },
    // 打开我的海报
    myHaibao() {
      this.$refs.haibaoDialog.open();
    },

    // 管理端的方法
    // 管理端统计初始化
    initByAdmin() {
      this.getGoodsTableDataTotal();
      this.getGoodsTableDataTimer();
      this.getYudouList();
      this.getSupplerUserTotal();
      this.getModuleYudouList();
    },
    // 获取模块虞豆消费统计
    getModuleYudouList() {
      getModuleYudou(this.yudouTypeParams).then((res) => {
        this.moduleYudouList = res.data;
      });
    },
    // 虞豆类型统计排序
    yudouTypeTableChange(val) {
      this.yudouTypeParams.sort = val.order == "ascending" ? "asc" : "desc";
      this.yudouTypeParams.sortColumn = val.prop;
      this.getModuleYudouList();
    },
    // 账号统计日期改变
    timerChange(e) {},

    // 商品统计表格 总商品
    getGoodsTableDataTotal() {
      goodsCountByTenant().then((res) => {
        this.supplerGoodsTotal = res.data;
      });
    },
    // 获取商家注册用户统计
    getSupplerUserTotal() {
      getSupplerUserTotal().then((res) => {
        this.supplerUserTotal = res.data;
      });
    },
    // 获取账号统计表格 时间段
    getGoodsTableDataTimer() {
      // day:1昨天
      goodsCountByTenant({ day: 1 }).then((res) => {
        this.supplerGoodsYesterday = res.data;
      });
    },
    // 获取商家虞豆统计
    getYudouList() {
      // sortColumn  sort
      yudouCountByTenant(this.yudouParams).then((res) => {
        this.yudouList = res.data;
      });
    },
    // 虞豆统计排序
    yudouSortChange(val) {
      this.yudouParams.sort = val.order == "ascending" ? "asc" : "desc";
      this.yudouParams.sortColumn = val.prop;
      this.getYudouList();
    },
    // 获取破晓余额
    getpoxiao() {
      checkPhoneApi.pxyue().then((res) => {
        this.poxiaoyue = res.data.data;
      });
    },
    // 以下是商户端的方法
    // 联系我们
    lianxiwomenfn() {
      this.$refs.Lianxiwomen.open();
    },
    // 复制
    copyStr(txt) {
      this.$copyText(txt).then(() => {
        this.$message.success("已复制到剪切板");
      });
    },
    // 获取轮播图资源
    getLunbo() {
      let obj = {
        systemType: 1,
      };
      resourcesManage.getList(obj).then((response) => {
        // console.log("%c Line:111 🥑 response", "color:#42b983", response);
        this.$nextTick(() => {
          // this.loading = false;
          this.lunboList = JSON.parse(JSON.stringify(response.rows));
          // this.tableData.total = response.total;
        });
      });
    },
    // 跳转链接
    goLink(val, query, permiStr,hasTimestamp=false) {
      if (val == "daishouwode") {
        this.getDaishouwode();
        return;
      }
      if (permiStr && !this.checkPermi([permiStr])) {
        return this.$message.error(
          "你还没有该模块权限，请联系管理员分配权限！"
        );
      }
      if (!val) {
        return;
      }
      // if (val == "/youzhishangjia") {
      //   return this.$message("正在优化中，请耐心等待...");
      // }
      if (val.indexOf("http") > -1) {
        window.open(val, "_blank");
      } else {
        if(hasTimestamp){
          // 加时间戳
          const timestamp = new Date().getTime();
          this.$router.push({
            path: val,
            query: {
              ...query,
              timestamp,
            },
          });
        }else{
          this.$router.push({
            path: val,
            query: query || null,
          });
        }
       
      }
    },
    // 跳转页面  用组件名
    goLinkName(name, permiStr) {
      if (permiStr && !this.checkPermi([permiStr])) {
        return this.$message.error(
          "你还没有该模块权限，请联系管理员分配权限！"
        );
      }
      this.$router.push({
        name: name,
      });
    },
    // 立即续费
    goJifenshangchneg() {
      this.$router.push({
        path: "/jifenshangcheng",
      });
    },
    // 获取自己开通的增值服务
    getMyService() {
      // if()
      valueAddedServices
        .myValueAddedServiceList({ dataType: "one" })
        .then((res) => {
          this.daoqiFuwu = [];
          if (res.rows && res.rows.length) {
            this.serviceList = res.rows;
            this.serviceList.forEach((r) => {
              if (this.getDayNum(r.closeTime) <= 5) {
                this.daoqiFuwu.push(r);
              }
            });
          } else {
            this.serviceList = [];
          }
        });
    },
    // 获取日期与当前日期相差天数
    getDayNum(val) {
      let date = Date.parse(new Date(val)) / 1000;
      var today = Date.parse(new Date()) / 1000; //当前时间戳
      var nTime = date - today;
      var day = Math.floor(nTime / 86400) + 1;
      return day;
    },
    // 获取掉绑待处理
    getmonitorTaskErrFn() {
      monitorTaskErr().then((res) => {
        this.monitorTaskErrNum = res.data;
      });
    },
    // // 获取滞销商品数量
    // getKucunNumFn() {
    //   getKucunNum().then((res) => {
    //     this.kucunNum = res.data.unsoldCount;
    //   });
    // },

    getOrderNums() {
      saleOrderNum().then((res) => {
        this.orderTotalNums = res.data;
      });
    },
    // getgoodsStatebyGame() {
    //   goodsStatebyGame(this.queryParams).then((res) => {
    //     this.goodsNums = res.data;
    //   });
    // },
    // 打开充值短信包的弹窗
    smsChongzhiOpen() {
      this.$refs.smsChongzhi.open();
    },
    // 点击充值
    chongzhijifen() {
      this.$refs.chongzhi.open();
      // this.$refs.paySuccess.open();
    },
    // 打开充值余额弹窗
    // 点击充值
    chongzhiyue() {
      this.$refs.chongzhiYue.open();
      // this.$refs.paySuccess.open();
    },
    // 虞豆明细
    yudoumingxi() {
      this.$router.push({
        path: "/shopManageByTenant/tenantPages/jifen",
      });
    },
  },
};
</script>

<style scoped lang="scss">
.app-container {
  min-width: 1200px;
  background-color: #f6f6f6;
  padding: 0;
  border-radius: 0;
}
::v-deep .app-main {
  overflow-x: auto;
}
.index_page {
  padding-bottom: 20px;
  .leftbox {
    width: 100%;
    .top_card {
      background: #6c5dd3;
      border-radius: 4px;
      padding: 16px 9px 8px;
      width: 100%;
      margin-right: 10px;
      &.goods {
        max-width: 200px;
      }
      &:last-of-type {
        margin-right: 0;
      }

      .tit {
        color: #fff;
        font-size: 18px;
        align-items: center;
        .icon {
          width: 1px;
          height: 18px;
          background: #ffffff;
          border: 2px solid #ffffff;
          margin-right: 5px;
        }
      }
      .top_inner {
        background: #fff;
        border-radius: 4px;
        padding: 16px;
        margin-top: 8px;
        text-align: center;
        justify-content: space-around;
        cursor: pointer;

        .top_item {
          cursor: pointer;
          &:hover {
            .label {
              color: #5e78fe;
            }
          }
        }
        .label {
          font-size: 18px;
        }
        .val {
          font-size: 18px;
          margin-bottom: 10px;
          line-height: 1em;
        }
      }
    }
    .top_box {
      justify-content: space-around;
    }
    .add-btn {
      position: absolute;
      top: 10px;
      right: 15px;
      cursor: pointer;
    }
    .dianpu_inner {
      flex-wrap: wrap;
      min-height: 98px;

      .item {
        width: 218px;
        height: 82px;
        background: #f7f8fa;
        border-radius: 4px;
        margin-right: 15px;
        margin-top: 16px;
        padding: 5px 15px;
        color: #666666;
        font-size: 16px;
        .value1 {
          color: #333;
          font-size: 18px;
          margin: 3px 0;
        }
      }
    }
    .create_btn_box {
      // justify-content: space-around;
      flex-wrap: nowrap;
      margin-top: 12px;
      min-height: 20px;
      .item {
        width: auto;
        height: auto;
        max-width: 192px;
        padding: 0;
        // height: 82px;
        
        margin: 0;
        margin-right: 10px;
        // background-size: 100% 100%;
        background-color: transparent;
        cursor: pointer;
        &:hover {
          transform: scale(1.1);
          transition: all 0.3s;
        }
      }
    }
    .sjtj_inner {
      margin-top: 20px;
      justify-content: space-around;
      .item {
        text-align: center;
        color: #666666;
        font-size: 16px;
        cursor: pointer;
        .name {
          align-items: center;
        }
        img {
          width: 16px;
          height: 16px;
          margin-right: 10px;
        }

        .value1 {
          color: #333;
          font-size: 18px;
          margin: 15px 0;
        }
      }
    }
  }
  .rgbox {
    width: 448px;
    margin-left: 8px;
    flex-shrink: 0;
  }
  .card {
    background: #ffffff;
    border-radius: 10px;
    padding: 16px;
    margin-top: 8px;
  }

  .shop_info {
    padding-top: 0;
    margin-top: 0;
    .btns {
      display: flex;
      justify-content: flex-end;
    }
    .head-img {
      margin-right: 8px;
      position: relative;
      width: 66px;
      height: 66px;
      background: #fff8e9;
      flex-shrink: 0;
      ::v-deep .el-upload {
        width: 66px;
        height: 66px;
        border: none;
        padding: 0;
        .btn {
          color: $fff;
        }
      }
      img {
        width: 100%;
        height: 100%;
        border-radius: 4px;
        position: absolute;
        top: 0;
        left: 0;
      }
      .btn {
        width: 100%;
        height: 18px;
        background-color: $primary;
        text-align: center;
        line-height: 18px;
        cursor: pointer;
        border-radius: 9px;
        position: absolute;
        bottom: 0;
      }
    }
    .shop_tit_box {
      align-items: center;
      b {
        font-size: 18px;
        width: 168px;
        overflow: hidden;
        white-space: nowrap;
        text-overflow: ellipsis;
      }
      img {
        height: 25px;
        margin-left: 5px;
        cursor: pointer;
      }
    }
    .name_box {
      margin-top: 5px;
      img {
        width: 15px;
        height: 15px;
      }
      .val {
        margin-left: 3px;
      }
      .name {
        margin-right: 10px;
      }
      a {
        color: #6c5dd3;
      }
      > span {
        align-items: center;
      }
    }
    .phonenum {
      margin-top: 5px;
    }
  }

  .zhanghu_box {
    .tit-box {
      margin-bottom: 10px;
      .shoukuanzhanghu {
        position: absolute;
        top: 15px;
        right: 15px;
        color: #6c5dd3;
        cursor: pointer;
      }
      .shuaxin {
        cursor: pointer;
        color: $green;
        margin-left: 10px;
      }
    }
    .yue_box {
      padding: 10px 0;
      border-bottom: 1px solid #f2f2f2;
      align-items: center;
      > .flex {
        align-items: center;
      }
      img {
        width: 40px;
        height: 40px;
        margin-right: 8px;
      }
    }
  }
  .daiban {
    background: linear-gradient(180deg, #f0efff 0%, #fdfdff 100%);
    .daiban_inner {
      margin-top: 15px;
      justify-content: space-around;
      text-align: center;
      .daiban_item {
        cursor: pointer;
      }
      img {
        width: 48px;
        height: 48px;
      }
    }
  }
  .gonggao_box {
    .gonggao_inner {
      margin-top: 10px;
      .gonggaoitem {
        align-items: center;
        margin-top: 10px;
        line-height: 1em;
        cursor: pointer;
        i {
          width: 3px;
          height: 3px;
          background: #333;
          margin-right: 5px;
        }
        .title {
          color: #666;
          &:hover {
            color: #999;
          }
        }
      }
    }
  }
}
.tit-box {
  align-items: center;
}
::v-deep .el-statistic .con {
  color: #ffdb00 !important;
}

div {
  box-sizing: border-box;
}
.tit,
.tit40 {
  font-weight: 500;
  font-size: 32px;
  color: #ffffff;
}
.tit40 {
  font-size: 24px;
}
.banner_box {
  width: 100%;
  height: 296px;
  background-image: url("../assets/img/home/bannerbg.png");
  background-repeat: no-repeat;
  background-position: center center;
  background-size: 100% 100%;
  overflow: hidden;
  justify-content: space-between;
  // align-items: center;
  padding: 18px;

  .linqi_box {
    padding-left: 30px;
    flex-shrink: 0;
    margin-right: 10px;
    min-width: 450px;
    overflow: hidden;
    .el-button {
      color: #6c5dd3;
      background-color: #fff;
      border: none;
      padding: 10px 35px;
      height: 46px;
      border-radius: 16px;
      font-size: 18px;
    }
    .shop-name {
      font-size: 32px;
      color: #fff;
      font-weight: bold;
      > span {
        width: 240px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
      }
    }
    .domainhost {
      justify-items: center;
      color: #fff;
      font-size: 20px;
      line-height: 40px;
      a {
        // background-color: $--color-success;
        // font-size: 20px;
        // padding: 0 15px;
        border-radius: 4px;
      }
      .el-button {
        margin-left: 10px;
      }
    }
    .item {
      display: flex;
      flex-wrap: nowrap;
      font-weight: 500;
      font-size: 16px;
      color: #ffdb00;
      line-height: 24px;
    }
    .btn {
      margin-top: 15px;
    }
  }
  .lunbo_box {
    min-width: 1000px;
    max-width: 1087px;
    height: 264px;
    border-radius: 10px;
    overflow: hidden;
    background-color: #fff;
    padding: 10px 15px;
    padding-right: 0;

    .top {
      position: relative;
      font-size: 16px;
      align-items: center;

      .youshi {
        color: #5e78fe;
        margin-left: 20px;
        font-weight: bold;
        padding-top: 15px;
      }
      .moreSJ {
        position: absolute;
        top: 15px;
        right: 26px;
        color: #6c5dd3;
        cursor: pointer;
        text-decoration-line: underline;
      }
    }

    .youzhi_box {
      flex-wrap: wrap;
      margin-top: 35px;
      height: 170px;
      .item {
        height: 54px;
        box-sizing: border-box;
        width: calc(20% - 7px);
        padding-left: 70px;
        // height: 74px;
        margin-right: 6px;
        margin-bottom: 32px;
        // text-align: center;
        // flex-wrap: nowrap;
        // overflow: hidden;
        border-radius: 27px;
        position: relative;
      }
      .touxiang {
        width: 56px;
        height: 56px;
        background: #ffffff;
        border-radius: 50%;
        text-align: center;
        position: absolute;
        top: -20px;
        left: 10px;
        img {
          width: 48px;
          height: 48px;
          border-radius: 50%;
          margin: 0 auto;
          margin-top: 4px;
        }
      }
      // .rg {
      //   width: calc(100% - 50px);
      //   margin-left: 5px;
      // }
      .name {
        color: #5f75ee;
        width: 100%;
        text-overflow: ellipsis;
        overflow: hidden;
        white-space: nowrap;
        line-height: 54px;
        font-size: 16px;
        font-weight: bold;
      }
    }
  }
}
.card {
  padding: 18px;
  background: #fff;
  border-radius: 10px;
  margin-top: 20px;
  position: relative;
}
.order_total_box {
  width: 100%;
  .cont_box {
    flex-wrap: nowrap;
    margin-top: 10px;
    .num_item {
      background: #ffa2c0;
      border-radius: 8px;
      justify-content: center;
      align-items: center;
      margin-right: 20px;
      height: 120px;
      width: 25%;
      color: #ffffff;
      &.jywc {
        background: #ffce73;
      }
      &.jysb {
        background: #a0d7e7;
      }
      &.shtj {
        background: #7fba7a;
      }
      img {
        width: 70px;
        height: 70px;
        margin-right: 15px;
      }
      .tit {
        font-weight: bold;
        font-size: 16px;

        height: 30px;
        line-height: 40px;
      }
      .num {
        font-weight: 500;
        font-size: 24px;
        line-height: 40px;
      }
    }
    @media screen and (max-width: 1650px) {
      .num_item {
        img {
          width: 45px;
          height: 45px;
          margin-right: 8px;
        }
        .tit {
          font-size: 14px;
        }
        .num {
          font-size: 22px;
        }
      }
    }
  }
}
.jifen_box {
  margin-top: 20px;
  width: 180px;
  border-radius: 10px;
  background: #fff;
  padding: 22px;
  margin-right: 16px;
  flex-shrink: 0;
  color: $primary;
  .jifen_rg {
    width: 100%;
    text-align: center;
    line-height: 50px;
    .tit {
      font-size: 28px;
      color: $primary;
      font-weight: 600;
    }
    .jifen_num {
      font-weight: 500;
      font-size: 26px;
      display: flex;
      align-items: center;
      justify-content: center;
      img {
        // vertical-align: middle;
        margin-right: 5px;
      }
    }
  }
}
.kucun_box {
  width: 460px;
  border-radius: 10px;
  background: #fff;
  padding: 22px;
  padding-bottom: 10px;
  margin-right: 16px;
  margin-top: 20px;
  text-align: center;
  color: #333;
  flex-shrink: 0;
  .cont_box {
    justify-content: space-between;
    padding-top: 10px;
  }
  .item {
    width: 129px;
    height: 129px;
    background-image: url("../assets/img/daibanbg.png");
    background-size: 100% 100%;
    padding: 16px;

    > .flex {
      align-items: center;
      font-size: 12px;
      font-weight: bold;
      div {
        margin-left: 5px;
        color: #000;
      }
    }
    img {
      width: 32px;
      height: 32px;
    }
  }
  .num {
    font-size: 26px;
    margin-top: 20px;
    color: $primary;
  }
}
.order_byday_person {
  .order_day {
    width: 100%;
  }
}
.zhuce_shangpin {
  .zhuce_box {
    width: 100%;
  }
  .person_order {
    width: 660px;
    flex-shrink: 0;
    margin-left: 16px;
  }
}
.shangpin_total {
  width: 560px;
  flex-shrink: 0;
  margin-right: 16px;
  position: relative;
  .search_box {
    position: absolute;
    top: 15px;
    right: 15px;
  }
  .total_num {
    font-size: 18px;
    text-align: center;
    padding-top: 20px;
  }
  .type_box {
    .item {
      margin-top: 12px;
      align-items: center;
      img {
        width: 36px;
        height: 36px;
        margin-right: 8px;
        flex-shrink: 0;
      }
      .rg {
        width: 100%;

        .num_box {
          justify-content: space-between;
          font-size: 16px;
          margin-bottom: 5px;
          font-weight: bold;
          .num {
            display: flex;
            > span {
              margin-right: 15px;
            }
          }
        }
      }
    }
  }
}

.myApp {
  flex-wrap: wrap;
  margin-top: 15px;
  .app_item {
    width: 80px;
    text-align: center;
    margin-bottom: 15px;
    cursor: pointer;
    &:hover {
      transform: scale(1.1);
      transition: 0.3s all;
    }
    img {
      width: 48px;
      height: 48px;
      border-radius: 8px;
    }
  }
}

.color666 {
  color: #666;
}
.color999 {
  color: #999;
}
</style>

